/**
 * 判断为空
 * @param {Object} obj
 */
var isEmpty = function (obj) {
  if (obj == null) {
    return true
  }
  let str = obj.trim()
  if (str === '' || str === 'null' || str === undefined || str === 'undefined' || str.length === 0) {
    return true
  }
  return false
}
/**
 * 判断不为空
 * @param {Object} obj
 */
var isNotEmpty = function (obj) {
  return !isEmpty(obj)
}
/**
 * 如果数据为空，则返回为空
 * @param {Object} obj
 */
var isReturn = function (obj) {
  if (isEmpty(obj)) {
    return ''
  }
  return obj
}
/**
 * 判断是否相等
 * @param {Object} obj1
 * @param {Object} obj2
 */
var verifyTheSame = function (obj1, obj2) {
  if (isEmpty(obj1) || isEmpty(obj2)) {
    return false
  }
  if (obj1.length === obj2.length) {
    if (obj1 === obj2) {
      return true
    }
  }
  return false
}

var isRegex = function (obj, regex) {
  if (isNotEmpty(obj)) {
    return false
  } else {

  }
}

var phoneRegex = '^1[3|4|5|7|8][0-9]{9}$'
var emailRegex = '^([a-zA-Z]|[0-9])(\\w|\\-)+@[a-zA-Z0-9]+\\.([a-zA-Z]{2,4})$'

export default {
  isEmpty,
  isNotEmpty,
  verifyTheSame,
  phoneRegex,
  emailRegex,
  isRegex,
  isReturn
}
